package cn.edu.scau.dao;

import cn.edu.scau.entity.NursingPlan;
import org.apache.ibatis.jdbc.SQL;

public class NursingPlanSqlProvider {

    public String insertSelective(NursingPlan record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("nursingplan");
        
        if (record.getCustomerid() != null) {
            sql.VALUES("customerID", "#{customerid,jdbcType=INTEGER}");
        }
        
        if (record.getNursingcontentid() != null) {
            sql.VALUES("nursingContentID", "#{nursingcontentid,jdbcType=INTEGER}");
        }
        
        if (record.getNursinglevelid() != null) {
            sql.VALUES("nursingLevelID", "#{nursinglevelid,jdbcType=INTEGER}");
        }
        
        if (record.getNursingplanperiod() != null) {
            sql.VALUES("nursingPlanPeriod", "#{nursingplanperiod,jdbcType=VARCHAR}");
        }
        
        if (record.getNursingplanfrequency() != null) {
            sql.VALUES("nursingPlanFrequency", "#{nursingplanfrequency,jdbcType=INTEGER}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(NursingPlan record) {
        SQL sql = new SQL();
        sql.UPDATE("nursingplan");
        
        if (record.getNursingplanperiod() != null) {
            sql.SET("nursingPlanPeriod = #{nursingplanperiod,jdbcType=VARCHAR}");
        }
        
        if (record.getNursingplanfrequency() != null) {
            sql.SET("nursingPlanFrequency = #{nursingplanfrequency,jdbcType=INTEGER}");
        }
        
        sql.WHERE("customerID = #{customerid,jdbcType=INTEGER}");
        sql.WHERE("nursingContentID = #{nursingcontentid,jdbcType=INTEGER}");
        sql.WHERE("nursingLevelID = #{nursinglevelid,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}